import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '审核状态',
    align: 'center',
    dataIndex: 'status',
    customRender: ({ text }) => {
      const statusMap = {
        0: { label: '未提交审核', color: '#666' },
        1: { label: '审核中', color: '#ff8c00' },
        2: { label: '通过审核', color: '#52c41a' },
        3: { label: '未通过审核', color: '#ff4d4f' },
      };
      const status = statusMap[text] || { label: '未知状态', color: '#666' };
      return `<span style="color: ${status.color}; font-weight: bold;">${status.label}</span>`;
    },
   },
   {
    title: 'AnfineID',
    align:"center",
    dataIndex: 'anfineId'
   },
   {
    title: '姓名',
    align: 'center',
    width: 100,
    dataIndex: 'name',
  },
  {
    title: '身份证号',
    align: 'center',
    dataIndex: 'idnumber',
    width: 200,
  },
   {
    title: '性别',
    width: 100,
    align: 'center',
    dataIndex: 'gender',
    customRender: ({ text }) => {
      const genderMap = {
        1: '男',
        2: '女',
      };
      return genderMap[text] || '错误的测试代码';
    },
  },
  {
    title: '年龄',
    align: 'center',
    width: 100,
    dataIndex: 'age',
  },
  {
    title: '手机号',
    align: 'center',
    dataIndex: 'phone',
  },
  {
    title: '邮箱',
    align: 'center',
    width: 220,
    dataIndex: 'email',
  },
  {
    title: '医院ID',
    align: 'center',
    dataIndex: 'hospital',
    width: 220
  },
  {
    title: '医院名称',
    align: 'center',
    dataIndex: 'hospitalname',
  },
  {
    title: '项目组ID',
    align: 'center',
    dataIndex: 'projectid',
    width: 220
  },
  {
    title: '项目组名称',
    align: 'center',
    dataIndex: 'projectname',
  },
  {
    title: '专业',
    align: 'center',
    dataIndex: 'major',
    defaultHidden: true
  },
  {
    title: '学历',
    align: 'center',
    dataIndex: 'education',
  },
  {
    title: '职业',
    align: 'center',
    dataIndex: 'profession',
  },
  {
    title: '职称',
    align: 'center',
    dataIndex: 'title',
  },
  {
    title: '职位',
    align: 'center',
    dataIndex: 'position',
  },
  {
    title: '工作年限',
    align: 'center',
    dataIndex: 'workyears',
  },
  {
    title: '执业证编号',
    align: 'center',
    dataIndex: 'licensenumber',
  },
  {
    title: '资格证编号',
    align: 'center',
    dataIndex: 'qualificationnumber',
    width: 220,
    customCell: () => {
      return {
        style: {
          wordWrap: 'break-word',
          wordBreak: 'break-all',
          whiteSpace: 'pre-wrap',
        },
      };
    },
  },
  {
    title: '证书获取时间',
    align: 'center',
    dataIndex: 'certificatetime',
    width: 220,
    customCell: () => {
      return {
        style: {
          wordWrap: 'break-word',
          wordBreak: 'break-all',
          whiteSpace: 'pre-wrap',
        },
      };
    },
  },
  {
    title: '是否为专家',
    align: 'center',
    dataIndex: 'isspecialty',
  },
  {
    title: '是否为教师',
    align: 'center',
    dataIndex: 'isteacher',
  },
  {
    title: '级别',
    align: 'center',
    dataIndex: 'level',
  },
  {
    title: '培训经历',
    align: 'center',
    dataIndex: 'training',
  },
  {
    title: '照片路径（存储文件路径）',
    align: 'center',
    dataIndex: 'photo',
    width: 400,
    customCell: () => {
      return {
        style: {
          wordWrap: 'break-word',
          wordBreak: 'break-all',
          whiteSpace: 'pre-wrap',
          maxWidth: '380px',
        },
      };
    },
  },
  {
    title: '技术特长（以逗号分隔的字符串）',
    align: 'center',
    dataIndex: 'skills',
  },
  {
    title: '个人简介',
    align: 'center',
    dataIndex: 'introduction',
  },
  {
    title: '地址',
    align: 'center',
    dataIndex: 'address',
    width: 220,
    customCell: () => {
      return {
        style: {
          wordWrap: 'break-word',
          wordBreak: 'break-all',
          whiteSpace: 'pre-wrap',
        },
      };
    },
  },
  {
    title: '证书编号',
    align: 'center',
    dataIndex: 'certificatenumber',
  },
  {
    title: '银行卡号码',
    align: 'center',
    dataIndex: 'bankcard',
  },
  {
    title: '微信openid',
    align: 'center',
    width: 220,
    dataIndex: 'openid',
    customCell: () => {
      return {
        style: {
          wordWrap: 'break-word',
          wordBreak: 'break-all',
          whiteSpace: 'pre-wrap',
        },
      };
    },
  },
  {
    title: '微信unionid',
    align: 'center',
    dataIndex: 'unionid',
  },
  {
    title: '合同ID',
    align: 'center',
    width: 220,
    dataIndex: 'flowId',
    customCell: () => {
      return {
        style: {
          wordWrap: 'break-word',
          wordBreak: 'break-all',
          whiteSpace: 'pre-wrap',
        },
      };
    },
  },
  {
    title: '合同编码',
    align: 'center',
    dataIndex: 'contractcode',
  },
  {
    title: '是否通过考试',
    align: 'center',
    dataIndex: 'passexam',
    customRender: ({ text }) => {
      if (text === 1 || text === '1') return '是';
      if (text === 0 || text === '0') return '否';
      return text || '';
    },
  },
  {
    title: '是否已签署',
    align: 'center',
    dataIndex: 'issign',
    customRender: ({ text }) => {
      if (text === 1 || text === '1') return '是';
      if (text === 0 || text === '0') return '否';
      return text || '';
    },
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '姓名',
    field: 'name',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '请输入姓名',
    },
  },
  {
    label: '身份证号',
    field: 'idnumber',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '请输入身份证号',
    },
  },
  {
    label: 'AnfineID',
    field: 'anfineId',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '请输入AnfineID',
    },
  },
  {
    label: '职位',
    field: 'position',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '请输入职位',
    },
  },
  {
    label: '医院',
    field: 'hospital',
    component: 'JSearchSelect',
    colProps: { span: 6 },
    componentProps: {
      dict: 'nurse_hospital,name,id',
    },
  },
  {
    label: '医院名称',
    field: 'hospitalname',
    component: 'JInput',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '请输入医院名称',
    },
  },
  {
    label: '项目组名称',
    field: 'projectname',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '请输入项目组名称',
    },
  },
  {
    label: '审核状态',
    field: 'status',
    component: 'Select',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '请选择审核状态',
      options: [
        { label: '未提交审核', value: 0 },
        { label: '审核中', value: 1 },
        { label: '通过审核', value: 2 },
        { label: '未通过审核', value: 3 },
      ],
    },
  },
  {
    label: '通过考试',
    field: 'passexam',
    component: 'Select',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '请选择是否通过考试',
      options: [
        { label: '是', value: '1' },
        { label: '否', value: '0' },
      ],
    },
  },
  {
    label: '是否已签署',
    field: 'issign',
    component: 'Select',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '请选择是否已签署',
      options: [
        { label: '是', value: '1' },
        { label: '否', value: '0' },
      ],
    },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '姓名',
    field: 'name',
    component: 'Input',
    dynamicRules: () => {
          return [
            { required: true, message: '请输入姓名!' },
          ];
     },
  },
  {
    label: '身份证号',
    field: 'idnumber',
    component: 'Input',
    dynamicRules: () => {
          return [
            { required: true, message: '请输入身份证号!' },
          ];
        },
  },
  {
    label: '审核状态',
    field: 'status',
    component: 'Select',
    componentProps: {
      placeholder: '请选择审核状态',
      options: [
        { label: '未提交审核', value: 0 },
        { label: '审核中', value: 1 },
        { label: '通过审核', value: 2 },
        { label: '未通过审核', value: 3 },
      ],
    },
  },
  {
    label: '性别',
    field: 'gender',
    component: 'InputNumber',
    dynamicRules: () => {
          return [
                 { required: true, message: '请输入性别!'},
          ];
     },
  },
  {
    label: '年龄',
    field: 'age',
    component: 'InputNumber',
  },
  {
    label: '手机号',
    field: 'phone',
    component: 'Input',
  },
  {
    label: '邮箱',
    field: 'email',
    component: 'Input',
  },
  {
    label: '所在医院',
    field: 'hospital',
    component: 'Input',
  },
  {
    label: '科室',
    field: 'department',
    component: 'Input',
  },
  {
    label: '专业',
    field: 'major',
    component: 'Input',
  },
  {
    label: '学历',
    field: 'education',
    component: 'Input',
  },
  {
    label: '职业',
    field: 'profession',
    component: 'Input',
  },
  {
    label: '职称',
    field: 'title',
    component: 'Input',
  },
  {
    label: '职位',
    field: 'position',
    component: 'Input',
  },
  {
    label: '工作年限',
    field: 'workyears',
    component: 'InputNumber',
  },
  {
    label: '执业证编号',
    field: 'licensenumber',
    component: 'Input',
  },
  {
    label: '资格证编号',
    field: 'qualificationnumber',
    component: 'Input',
  },
  {
    label: '证书获取时间',
    field: 'certificatetime',
    component: 'Input',
  },
  {
    label: '是否为专家',
    field: 'isspecialty',
    component: 'Input',
  },
  {
    label: '是否为教师',
    field: 'isteacher',
    component: 'Input',
  },
  {
    label: '级别',
    field: 'level',
    component: 'Input',
  },
  {
    label: '培训经历',
    field: 'training',
    component: 'Input',
  },
  {
    label: '照片路径（存储文件路径）',
    field: 'photo',
    component: 'Input',
  },
  {
    label: '技术特长（以逗号分隔的字符串）',
    field: 'skills',
    component: 'Input',
  },
  {
    label: '个人简介',
    field: 'introduction',
    component: 'InputTextArea',
  },
  {
    label: '地址',
    field: 'address',
    component: 'Input',
  },
  {
    label: '证书编号',
    field: 'certificatenumber',
    component: 'Input',
  },
  {
    label: '银行卡号码',
    field: 'bankcard',
    component: 'Input',
  },
  {
    label: '微信openid',
    field: 'openid',
    component: 'Input',
  },
  {
    label: '微信unionid',
    field: 'unionid',
    component: 'Input',
  },
  {
    label: '合同编码',
    field: 'contractcode',
    component: 'Input',
  },
  {
    label: '是否通过考试',
    field: 'passexam',
    component: 'Select',
    componentProps: {
      placeholder: '请选择是否通过考试',
      options: [
        { label: '是', value: '1' },
        { label: '否', value: '0' },
      ],
    },
  },
  {
    label: '是否已签署',
    field: 'issign',
    component: 'Select',
    dynamicDisabled: true,
    componentProps: {
      placeholder: '请选择是否已签署',
      options: [
        { label: '是', value: '1' },
        { label: '否', value: '0' },
      ],
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 审核专用表单配置
export const auditFormSchema: FormSchema[] = [
  {
    label: '审核状态',
    field: 'status',
    component: 'Select',
    colProps: { span: 22 },
    componentProps: {
      options: [
        { label: '未提交审核', value: 0 },
        { label: '审核中', value: 1 },
        { label: '审核通过', value: 2 },
        { label: '不通过', value: 3 },
      ],
    },
    dynamicRules: () => {
      return [
        { required: true, message: '请选择审核状态!'},
      ];
    },
  },
  // 主键隐藏字段
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

// 高级查询数据
export const superQuerySchema = {
  anfineId: {title: 'AnfineID',order: 0,view: 'text', type: 'string',},
  name: {title: '姓名',order: 1,view: 'text', type: 'string',},
  idnumber: {title: '身份证号',order: 2,view: 'text', type: 'string',},
  gender: {title: '性别, 1男 0女',order: 3,view: 'number', type: 'number',},
  age: {title: '年龄',order: 4,view: 'number', type: 'number',},
  phone: {title: '手机号',order: 5,view: 'text', type: 'string',},
  email: {title: '邮箱',order: 6,view: 'text', type: 'string',},
  hospital: {title: '医院',order: 7,view: 'list', type: 'string',dictTable: "nurse_hospital", dictCode: 'id', dictText: 'name',},
  hospitalname: {title: '医院名称',order: 8,view: 'text', type: 'string',},
  projectid: {title: '项目组ID',order: 9,view: 'text', type: 'string',},
  projectname: {title: '项目组名称',order: 10,view: 'text', type: 'string',},
  department: {title: '科室',order: 11,view: 'text', type: 'string',},
  major: {title: '专业',order: 9,view: 'text', type: 'string',},
  education: {title: '学历',order: 10,view: 'text', type: 'string',},
  profession: {title: '职业',order: 11,view: 'text', type: 'string',},
  title: {title: '职称',order: 12,view: 'text', type: 'string',},
  position: {title: '职位',order: 13,view: 'text', type: 'string',},
  workyears: {title: '工作年限',order: 14,view: 'number', type: 'number',},
  licensenumber: {title: '执业证编号',order: 15,view: 'text', type: 'string',},
  qualificationnumber: {title: '资格证编号',order: 16,view: 'text', type: 'string',},
  certificatetime: {title: '证书获取时间',order: 17,view: 'text', type: 'string',},
  isspecialty: {title: '是否为专家',order: 18,view: 'text', type: 'string',},
  isteacher: {title: '是否为教师',order: 19,view: 'text', type: 'string',},
  level: {title: '级别',order: 20,view: 'text', type: 'string',},
  training: {title: '培训经历',order: 21,view: 'text', type: 'string',},
  photo: {title: '照片路径（存储文件路径）',order: 22,view: 'text', type: 'string',},
  skills: {title: '技术特长（以逗号分隔的字符串）',order: 23,view: 'text', type: 'string',},
  introduction: {title: '个人简介',order: 24,view: 'textarea', type: 'string',},
  address: {title: '地址',order: 25,view: 'text', type: 'string',},
  certificatenumber: {title: '证书编号',order: 26,view: 'text', type: 'string',},
  status: {title: '审核状态：0未提交审核 1审核中 2审核通过 3未通过',order: 27,view: 'number', type: 'number',},
  bankcard: {title: '银行卡号码',order: 28,view: 'text', type: 'string',},
  openid: {title: '微信openid',order: 29,view: 'text', type: 'string',},
  unionid: {title: '微信unionid',order: 30,view: 'text', type: 'string',},
  passexam: {title: '是否通过考试',order: 31,view: 'number', type: 'number',},
  issign: {title: '是否已签署',order: 32,view: 'number', type: 'number',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
